@extends('extend.admin')
@section('title','用户添加')
@section('content')
<section id="main-content">
    <div class="row">
        <div class="col-md-12">
            <!--breadcrumbs start -->
            <ul class="breadcrumb">
                <li><a href="#">首页</a>
                </li>
                <li>商品管理</li>
                <li class="active">商品修改</li>
            </ul>
            <!--breadcrumbs end -->
            <h1 class="h1">商品修改</h1>
        </div>
    </div>
        <div class="row">
            <div class="col-md-12">
            <form action="/goods/update" method="post" enctype="multipart/form-data">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">修改商品</h3>
                    </div>
                    @if(count($errors)>0)
                        <div class="alert alert-danger alert-dismissable">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            @foreach ($errors->all() as $error)
                            <strong>哇哦...出错了!!!</strong>:{{$error}}<br/>
                            @endforeach
                        </div>
                    @endif
                    <div class="panel-body">
                        <div class="col-md-12">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="exampleInputEmail2">商品标题</label>
                                    <input type="text" name="title" class="form-control" id="exampleInputEmail2" value="{{$goods->title}}">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="exampleInputEmail2">商品价格</label>
                                    <input type="text" name="price" class="form-control" id="exampleInputEmail2" value="{{$goods->price}}">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <label for="exampleInputEmail2">商品库存</label>
                                    <input type="text" name="store" class="form-control" id="exampleInputEmail2" value="{{$goods->store}}">
                                    <input type="hidden" name="id" class="form-control" id="exampleInputEmail2" value="{{$goods->id}}">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="col-md-12">
                            <label for="exampleInputEmail2">商品分类</label>
                                <input type="hidden" name="type_id" class="form-control" id="exampleInputEmail2" value="{{$goods->type_id}}" readonly="true">
                                <input type="text" name="" class="form-control" id="exampleInputEmail2" value="{{$path}}" readonly="true">
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="col-md-12" style="padding:20px 12px">
                            <label for="exampleInputEmail2">商品图片</label>
                                @foreach($img as $k=>$v)
                                    <img width='100' height='100' src="{{$v->path}}">
                                @endforeach
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="col-md-12" style="padding:20px 12px">
                            <label for="exampleInputEmail2">发布状态</label>
                                <div>
                                    立即发布&nbsp;:&nbsp;<input type="radio" name="status" value="1" id="exampleInputEmail2" @if($goods->status=='1') checked @endif>&nbsp;&nbsp;&nbsp;&nbsp;
                                    放入仓库&nbsp;:&nbsp;<input type="radio" name="status" value="0" id="exampleInputEmail2" @if($goods->status=='0') checked @endif>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="col-md-12" style="padding:20px 12px">
                            <label for="exampleInputEmail2">商品尺码</label>
                                <div>
                                    L&nbsp;:&nbsp;<input type="checkbox" name ="size[]" value="L" id="exampleInputEmail2" @if(in_array('L',$size)) checked @endif>
                                    S&nbsp;:&nbsp;<input type="checkbox" name ="size[]" value="S" id="exampleInputEmail2" @if(in_array('S',$size)) checked @endif>
                                    M&nbsp;:&nbsp;<input type="checkbox" name ="size[]" value="M" id="exampleInputEmail2" @if(in_array('M',$size)) checked @endif>
                                    XL&nbsp;:&nbsp;<input type="checkbox" name ="size[]" value="XL" id="exampleInputEmail2" @if(in_array('XL',$size)) checked @endif>
                                    XXL&nbsp;:&nbsp;<input type="checkbox" name ="size[]" value="XXL" id="exampleInputEmail2" @if(in_array('XXL',$size)) checked @endif>
                                    XXXL&nbsp;:&nbsp;<input type="checkbox" name ="size[]" value="XXXL" id="exampleInputEmail2" @if(in_array('XXXL',$size)) checked @endif>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-12">
                            <div class="col-md-12" style="padding:20px 12px">
                            <label for="exampleInputEmail2">商品颜色</label>
                                <div>
                                    富士红&nbsp;:&nbsp;<input type="checkbox" name="color[]" value="富士红" id="exampleInputEmail2" @if(in_array('富士红',$color)) checked @endif>
                                    天空蓝&nbsp;:&nbsp;<input type="checkbox" name="color[]" value="天空蓝" id="exampleInputEmail2" @if(in_array('天空蓝',$color)) checked @endif>
                                    简约灰&nbsp;:&nbsp;<input type="checkbox" name="color[]" value="简约灰" id="exampleInputEmail2" @if(in_array('简约灰',$color)) checked @endif>
                                    典雅白&nbsp;:&nbsp;<input type="checkbox" name="color[]" value="典雅白" id="exampleInputEmail2" @if(in_array('典雅白',$color)) checked @endif>
                                    尊贵黑&nbsp;:&nbsp;<input type="checkbox" name="color[]" value="尊贵黑" id="exampleInputEmail2" @if(in_array('尊贵黑',$color)) checked @endif>
                                    宝石绿&nbsp;:&nbsp;<input type="checkbox" name="color[]" value="宝石绿" id="exampleInputEmail2" @if(in_array('宝石绿',$color)) checked @endif>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">商品详情</h3>
                    </div>
                    <div class="panel-body">
                        <div class="form-group">
                            <!-- 加载编辑器的容器 -->
                            <script id="editor" name="detail" type="text/plain" style="width:100%;height:300px;">{!! $goods->detail !!}</script>
                            <!-- 配置文件 -->
                            <script type="text/javascript" src="/admins/ueditor/ueditor.config.js"></script>
                            <!-- 编辑器源码文件 -->
                            <script type="text/javascript" src="/admins/ueditor/ueditor.all.js"></script>
                            <!-- 实例化编辑器 -->
                            <script type="text/javascript">
                                var ue = UE.getEditor('editor');
                            </script>
                        </div>
                        <button type="submit" class="btn btn-success"><i class="fa fa-check"></i> 提交</button>
                    </div>
                   {{csrf_field()}}
                </div>
            </form>
            </div>
        </div>
           
</section>
@endsection